package com.qingpeng.pay.service;

import android.app.Notification;
import android.util.Log;

import com.qingpeng.pay.api.Host;
import com.qingpeng.pay.api.RedBag;
import com.qingpeng.pay.beans.NullBean;
import com.qingpeng.pay.okhttp.RetrofitCreateHelper;
import com.qingpeng.pay.utils.APP;

import java.util.HashMap;
import java.util.Map;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;


public class AlipayNotificationHandle extends NotificationHandle{
        public AlipayNotificationHandle(String pkgtype,Notification notification,IDoPost postpush){
                super(pkgtype,notification,postpush);
        }

        public void handleNotification(){
                if(title.contains("支付宝")){
                        if(content.contains("成功收款") | content.contains("向你付款")){
                                Map<String,String> postmap=new HashMap<String,String>();
                                postmap.put("time",notitime);
                                postmap.put("title","支付宝支付");
                                postmap.put("money",extractMoney(content));
                                postmap.put("content",content);
                                postmap.put("user_id", APP.uid);
                                Log.d("++++++++++++",postmap.toString());
//                                postpush.doPost(postmap);
                                Call<NullBean> postceshi = RetrofitCreateHelper.createApi(RedBag.class, Host.HOST).postceshi(postmap);
                                postceshi.enqueue(new Callback<NullBean>() {
                                        @Override
                                        public void onResponse(Call<NullBean> call, Response<NullBean> response) {
                                                LogUtil.debugLog("11111111111");
                                        }

                                        @Override
                                        public void onFailure(Call<NullBean> call, Throwable t) {
                                                LogUtil.debugLog("22222222222");
                                        }
                                });
                                return ;
                        }
                }



        }













}
